<template>
	<view class="container">
		<view class="tui-page__hd">
			<view class="tui-page__title">Slider</view>
			<view class="tui-page__desc">滑动选择器，支持样式设置，支持区间选择</view>
		</view>
		<view class="tui-page__bd tui-page__spacing">
			<view class="tui-title">默认使用</view>
			<tui-slider></tui-slider>
			<view class="tui-title tui-pb">显示value值</view>
			<tui-slider :width="width" showValue></tui-slider>
			<view class="tui-title">value值显示位置</view>
			<tui-slider :width="width" showValue position="bottom" boxColor="#5677fc" valueColor="#fff"></tui-slider>
			<view class="tui-title tui-pt">自定义value值显示</view>
			<view class="tui-slider__container">
				<tui-slider @changing="changing"></tui-slider>
				<view class="tui-value__text">{{ value }}</view>
			</view>
			<view class="tui-title  tui-pb">设置步长 5</view>
			<tui-slider :width="width" :step="5" showValue></tui-slider>
			<view class="tui-title  tui-pb">最小值100/最大值1000</view>
			<tui-slider :width="width" :min="100" :max="1000" showValue></tui-slider>
			<view class="tui-title">默认值/禁用不可滑动</view>
			<tui-slider :width="width" disabled :value="defaultVal"></tui-slider>
			<view class="tui-title  tui-pb">区间选择</view>
			<tui-slider :width="width" section showValue @change="change"></tui-slider>
			<view class="tui-title">样式调整</view>
			<tui-slider :width="width" backgroundColor="#666" activeColor="#f74d54" blockBorder="3px solid #fff" blockColor="#f74d54"
			 :blockWidth="16" :blockHeight="16"></tui-slider>
			<view class="tui-title">样式调整</view>
			<tui-slider :width="width" :height="8" radius="8px"  backgroundColor="#477A90" activeColor="linear-gradient(90deg, #6CDFEF,#10D676)"
			 blockRadius="2px" :blockWidth="24" :blockHeight="16" section showValue position="bottom" valueColor="#013554" boxColor="#FBF9C6"
			 :valueSize="28" valueFormat="$value" @change="change">
				<template v-slot:start>
					<image src="/static/images/extend/icon_line.png" class="tui-icon__line" mode="widthFix"></image>
				</template>
				<template v-slot:end>
					<image src="/static/images/extend/icon_line.png" class="tui-icon__line" mode="widthFix"></image>
				</template>
			</tui-slider>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				width: uni.upx2px(620),
				value: 0,
				defaultVal: 0
			};
		},
		onLoad() {
			this.defaultVal = 60
		},
		methods: {
			changing(e) {
				this.value = e.value;
			},
			change(e) {
				console.log(e)
			}
		}
	};
</script>

<style>
	.container {
		padding-bottom: 120rpx;
	}

	.tui-page__spacing {
		width: 100%;
		padding: 0 60rpx;
		box-sizing: border-box;
	}

	.tui-title {
		width: 100%;
		padding: 50rpx 0 30rpx;
		box-sizing: border-box;
	}

	.tui-pt {
		padding-top: 80rpx;
	}

	.tui-pb {
		padding-bottom: 80rpx;
	}

	.tui-slider__container {
		display: flex;
		align-items: center;
	}

	.tui-value__text {
		padding-left: 20rpx;
		font-size: 30rpx;
		color: #555;
	}

	.tui-icon__line {
		width: 12px;
		height: 12px;
		display: block;
	}
</style>
